package java_thinking.unit_21.Exercise.thread;

import java.util.concurrent.*;

/**
 * @Desc:  创建线程的多种方式
 * @author: cww
 * @DateTime: 2019-08-08 19:54
 */

public class CreateThreadWay {
    public static void main(String[] args) {
        Thread t1 = new Method();t1.start();
        Thread t2 = new Thread(new Method1());t2.start();
        FutureTask task = new FutureTask(new Method2());Thread t3 = new Thread(task);t3.start();
        ThreadPoolExecutor executor = new ThreadPoolExecutor(2,5,0, TimeUnit.SECONDS, new LinkedBlockingDeque());
        executor.execute(new Method1());
    }

    static class Method extends Thread {
        @Override
        public void run(){

        }
    }

    static class Method1 implements Runnable {

        @Override
        public void run() {

        }
    }

    static class Method2 implements Callable {

        @Override
        public Object call() throws Exception {
            return null;
        }
    }
}
